package com.fbee.smartcommunities.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fbee.smartcommunities.core.Base;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import lombok.*;

/**
 * <p>
 * 商品
 * </p>
 *
 * @author 汪佳泉
 * @since 2024-08-16
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class Goods extends Base {

    private static final long serialVersionUID = 1L;

    /**
     * 商品名称
     */
    private String name;

    /**
     * 商品描述
     */
    private String description;

    /**
     * 商品编号
     */
    private String no;

    /**
     * 原价
     */
    private BigDecimal price;

    /**
     * 折扣
     */
    private BigDecimal discount;

    /**
     * 库存
     */
    private Integer store;

    /**
     * 点赞数
     */
    private Integer praise;

    /**
     * 浏览量
     */
    private Integer browse;

    /**
     * 销量
     */
    private Integer sales;

    /**
     * 分类id
     */
    private Long categoryId;

    /**
     * 商品图片
     */
    private String imgs;

    /**
     * 创建时间
     */
    private LocalDateTime createTime;

    /**
     * 商品上架状态 0-上架 1-下架
     */
    private Integer state;

    /**
     * 商家id
     */
    private Long shopId;

    /**
     * 是否推荐首页 0-不推荐 1-推荐
     */
    private Integer recommend;

    /**
     * 商家控制是否上架
     */
    private Integer stateUser;

    /**
     * 所属商家名字
     */
    @TableField(exist = false) // 表明这个字段不是数据库表中的字段
    private String shopName;

    /**
     * 所属店家名字
     */
    @TableField(exist = false) // 表明这个字段不是数据库表中的字段
    private String userName;

    @Override
    public String toString() {
        return "Goods{" +
                "name='" + name + '\'' +
                ", description='" + description + '\'' +
                ", no='" + String.format("%015d", no) + '\'' +
                ", price=" + price +
                ", discount=" + discount +
                ", store=" + store +
                ", praise=" + praise +
                ", browse=" + browse +
                ", sales=" + sales +
                ", categoryId=" + categoryId +
                ", imgs='" + imgs + '\'' +
                ", createTime=" + createTime +
                ", state=" + state +
                ", shopId=" + shopId +
                ", shopName=" + shopName +
                ", stateUser=" + stateUser +
                '}';
    }

    public Goods(String name, String description, String no, BigDecimal price, Long categoryId, String imgs, LocalDateTime createTime) {
        this.name = name;
        this.description = description;
        this.no = no;
        this.price = price;
        this.categoryId = categoryId;
        this.imgs = imgs;
        this.createTime = createTime;
    }

    public Goods(String name, String description, String no, BigDecimal price, BigDecimal discount, Integer store, Integer praise, Integer browse, Integer sales, Long categoryId, String imgs, LocalDateTime createTime, Integer state, Long shopId, Integer recommend, Integer stateUser) {
        this.name = name;
        this.description = description;
        this.no = no;
        this.price = price;
        this.discount = discount;
        this.store = store;
        this.praise = praise;
        this.browse = browse;
        this.sales = sales;
        this.categoryId = categoryId;
        this.imgs = imgs;
        this.createTime = createTime;
        this.state = state;
        this.shopId = shopId;
        this.recommend = recommend;
        this.stateUser = stateUser;
    }
}
